package com.kehutong.house.dao;

import org.coraframework.orm.annotation.Dao;
import org.coraframework.orm.annotation.Mapper;
import org.coraframework.orm.jdbc.Page;
import org.coraframework.orm.jdbc.execute.Condition;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Dao
public interface ShopDao {

	@Mapper(
			genericType = HashMap.class,
			countSQL ="select count(1) from t_shop s LEFT JOIN t_shop_classify b ON b.id = s.shopClassifyNo AND s.deleted = false where ${}",
			sql="select s.id, s.communityNo," +
					"s.communityName," +
					"s.shopClassifyNo," +
					"s.shopClassifyName," +
					"s.name," +
					"s.enable," +
					"s.viewName," +
					"s.propertyType," +
					"s.buildArea," +
					"s.useArea," +
					"s.payArea," +
					"s.ownerNo," +
					"s.ownerName," +
					"s.ownerMobile," +
					"s.salesStatus," +
					"s.harvestStatus," +
					"s.decoratedStasus," +
					"s.resideStasus," +
					"s.rentStasus," +
					"s.deleted," +
					"b.employeeNos from t_shop s LEFT JOIN t_shop_classify b ON b.id = s.shopClassifyNo AND s.deleted = false where ${}"
	)
	public Page<Map<String, Object>> loadPage(Condition...condition);

	@Mapper(
			genericType = HashMap.class,
			sql="select s.id, s.communityNo," +
					"s.communityName," +
					"s.shopClassifyNo," +
					"s.shopClassifyName," +
					"s.name," +
					"s.viewName," +
					"s.propertyType," +
					"s.buildArea," +
					"s.useArea," +
					"s.payArea," +
					"s.enable," +
					"s.ownerNo," +
					"s.ownerName," +
					"s.ownerMobile," +
					"s.salesStatus," +
					"s.harvestStatus," +
					"s.decoratedStasus," +
					"s.resideStasus," +
					"s.rentStasus," +
					"s.deleted," +
					"b.employeeNos from t_shop s LEFT JOIN t_shop_classify b ON b.id = s.shopClassifyNo AND s.deleted = false where ${}"
	)
	public List<Map<String, Object>> loadList(Condition...condition);
}
